package logic

import (
	"context"

	"mail/service/property/api/internal/svc"
	"mail/service/property/api/internal/types"
	"mail/service/property/rpc/property"

	"github.com/zeromicro/go-zero/core/logx"
)

type EliminateLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewEliminateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EliminateLogic {
	return &EliminateLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *EliminateLogic) Eliminate(req *types.EliminateRequest) (resp *types.EliminateResponse, err error) {
	// todo: add your logic here and delete this line
	_, err = l.svcCtx.PropertyRpc.Eliminate(l.ctx, &property.EliminateRequest{
		Id: req.Id,
	})
	if err != nil {
		return nil, err
	}
	return &types.EliminateResponse{}, nil
}
